<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description"
	content="碳氢知识平台由碳三氢二个人创建，属于免费开放的知识浏览平台。该平台主要用于学习Java相关的知识。">
<meta name="keywords"
	content="碳氢知识,碳三氢二,tansanqinger,tanqingzhishi,C3H2,c3h2,碳十八氢十二,碳三,tansan,C18H12">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="spm_prefix" content="333.851">
<link rel="icon" href="/img/index.ico" />
<link rel="shortcut icon" href="/img/index.ico" />
<meta charset="UTF-8" name="viewport"
	content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/layui/css/layui.css">
<link rel="stylesheet" href="https://demo.easyweb.vip/iframe/assets/module/admin.css?v=318"/>
<script src="/layui/layui.js"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script type="text/javascript" src="https://demo.easyweb.vip/iframe/assets/js/common.js?v=318"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/sockjs-client/1.4.0/sockjs.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/stomp.js/2.3.3/stomp.min.js"></script>
<title>碳氢知识</title>
<style type="text/css">
*{margin:0px auto;padding:0px auto;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
body,html{background-color:#F5F5F5; width: 100%; height: 100%;min-width: 1280px;min-height: 800px;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-webkit-justify-content: center;-ms-flex-pack: center;justify-content: center;}
.paddingRightLeft0{padding-right:0px;padding-left: 0px;}
.col, .col-1, .col-10, .col-11, .col-12, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-auto, .col-lg, .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-auto, .col-md, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-auto, .col-sm, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-auto{padding-left: 0px;padding-top: 0px;}
.pageTopSize{width: 100%;height: 90%;margin-top: 0px;margin-left: 0px;margin-bottom: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;}
.pageBottomSize{width: 100%;height: 10%;margin-top: 0px;margin-left: 0px;margin-bottom: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;}
.fixed{position: fixed;left: 0px;bottom: 0px;width: 100%;height: 54px;z-index: 9999;background-color:	#F5F5F5;}
.fixedBottom{left: 0px;bottom: 0px;width: 100%;height: 54px;}
a:link{color: #000;}
a:visited{color: #000;}
a:hover {text-decoration: none;}
.viridian{background-color: #3F7F62;}
.turquoise{background-color: #40E0D0;}
.layui-nav .layui-nav-more{border-top-color:#000000;margin-top: -0px;}
.layui-nav .layui-nav-mored{border-color: transparent transparent #000000;margin-top: -5px;}
.img-group {
  position: relative;
  display: inline-block;
}
        
.img-tip {
  position: absolute;
  bottom: 1;
  background: #FAFAD2;
  color: #000;
  opacity: 0.6;
  z-index:9999;
  display: none;
}
        
.img-group:hover .img-tip {
  display: block;
  width: 100%;
  width:70px;
  text-align: center;
}
.layui-layedit{
	border-width: 0px;
    border-style: none;
    border-radius: 0px;
}
.btn:focus,.btn:active:focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn.active.focus {outline: none;box-shadow:none;}
#chatMessage::-webkit-scrollbar {
  width: 4px;
  display: none;
}
#chatMessage:hover::-webkit-scrollbar {
  width: 4px;
  display: block;
}
#containerDiv3::-webkit-scrollbar {
  width: 4px;
  display: none;
}
#containerDiv3:hover::-webkit-scrollbar {
  width: 4px;
  display: block;
}
#containerDiv4::-webkit-scrollbar {
  width: 1px;
  display: none;
}
#containerDiv4:hover::-webkit-scrollbar {
  width: 1px;
  display: block;
}
.layui-table tbody tr:hover, .layui-table thead tr{
    background-color: transparent;
}
</style>
</head>
<body>
<div class="container">
  <div class="row">
	<div style="text-align: center; height:70px; line-height:70px;">
	   <img alt="" src="/img/logo_interface.png" style="height: 40px; display: inline-block; vertical-align: middle;padding:0 1.75rem" />
	</div>
    <div class="col-6" style="line-height: 70px; font-size: 30px;">
    	<ul class="layui-nav" lay-filter="" style="background-color: #F5F5F5; ">
		  <span th:each="menus:${menuAll}">
			  <li class="layui-nav-item" th:each="menu:${menus}" th:if="${menuStat.first}">
			  	<a th:href="${menu.hmenuUrl}" style="font-size: 30px; color: #000000;" th:if="${menu.hmenuOrder}==1">[[${menu.hmenuName}]]</a>
			    <dl class="layui-nav-child" th:if="${menuStat.last}==false and ${menuStat.first}"> <!-- 二级菜单 -->
			      <dd th:each="menu:${menus}"><a th:if="${menu.hmenuOrder}!=1" th:href="${menu.hmenuUrl}" style="height: 30px; line-height: 26px;">[[${menu.hmenuName}]]</a></dd>
			    </dl>
			  </li>
		  </span>
	 </ul>
    </div>
    <div class="col" style="text-align: right; line-height: 70px; font-size: 16px;word-spacing: 16px;">
		<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-search" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
		  <path fill-rule="evenodd" d="M10.442 10.442a1 1 0 0 1 1.415 0l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1 1 0 0 1 0-1.415z"/>
		  <path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>
		</svg>
		<span onclick="showImg()">手机APP</span>
		<span th:if="${user}==null">
			<a href="/login">登陆</a>
			<a href="/login/register">
				<button type="button" class="btn btn-primary">注册</button>
			</a>
		</span>
		<span th:if="${user}!=null">
			<span class="btn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				<img th:src="@{${user.img}}" style="width: 40px; height: 40px; border-radius: 50%;" alt="头像">
			</span>
			<div class="dropdown-menu">
				<a class="dropdown-item" th:if="${user.jurisdiction}==0" href="/account/user/index"
					style="height: 30px; line-height: 30px;" target="_blank">账号中心</a>
				<a class="dropdown-item" href="/account/user/message" style="height: 30px; line-height: 30px;" target="_blank">消息中心</a>
				<a class="dropdown-item" href="/" style="height: 30px; line-height: 30px;">退出登陆</a>
			</div>
		</span>
    </div>
  </div>
</div>


<div class="container">
	<div class="row" id="containerDiv">
		<div class="col-sm-3" style="padding-right: 0px; border: solid  #e2e2e2 2px; border-radius: 5px; background-color: #fff;" >
		<div>
			<div class="layui-col-md2" style="border-right: solid #e2e2e2 1px;" id="containerDiv2">
				<div style="text-align: center; margin-top: 20px; background-color: #fff;">
					<img th:src="@{${user.img}}" style="width: 30px; height: 30px; border-radius: 50%;" alt="头像" th:attr="onclick='submitHeadPortrait('+${user.id}+')'"><br><br>
				<div class="img-group">
					<a href="/exchange/index"><i class="layui-icon layui-icon-reply-fill" style="font-size: 30px; color: #000;"></i></a>
					<div class="img-tip" style="width: 35px;">信息</div>
				</div><br><br>
				<div class="img-group">
					<a href="/exchange/linkman"><i class="layui-icon layui-icon-group" style="font-size: 30px; color: #1E90FF;"></i></a>
					<div class="img-tip" style="width: 55px;">联系人</div>
				</div><br><br>
				<div class="img-group">
					<a href="/exchange/file"><i class="layui-icon layui-icon-upload" style="font-size: 30px; color: #000;"></i></a>
					<div class="img-tip" style="width: 70px;">文件中心</div>
				</div>
				</div>
			</div>
		    <div class="layui-col-md10" >
		    	<div class="layui-inline" style="margin: 5px;">
					<div class="layui-input-inline" style="padding-bottom: 5px;">
						<input type="tel" class="layui-input" style="height: 20px; width: 190px; line-height: 10px; font-size: 12px;">
					</div>&nbsp;&nbsp;
					<div class="img-group">
					<i class="layui-icon layui-icon-addition" style="font-size: 20px; color: #000;"></i> 
					<div class="img-tip">添加群聊</div>
				</div>
				</div>
		      <div class="layui-card" style="overflow:auto" id="containerDiv3">
		      	<div>
			      	<div style="border: solid #e2e2e2 1px; height: 60px; line-height: 60px;" onclick="newLinkman();">
				      	<div class="layui-col-md12" style="height: 60px; margin-left: 20px; width: 50px;">
				      		<i class="layui-icon layui-icon-friends" style="font-size: 40px; color: #FFB800;"></i>
				      	</div>
				      	<div style="padding-left: 50px;">
				      		<span style="font-size: 18px;">新的朋友</span><br>
				      	</div>
			      	</div>
			      </div>
		      	  <div>
			      	<div style="border: solid #e2e2e2 1px; height: 60px; line-height: 60px;" onclick="selectLinkmanAndGroupChat();">
				      	<div class="layui-col-md12" style="height: 60px; margin-left: 10px; width: 60px;">
				      		<i class="layui-icon layui-icon-group" style="font-size: 40px; color: #5FB878;"></i>
				      	</div>
				      	<div style="padding-left: 50px;">
				      		<span style="font-size: 18px;">添加好友/群聊</span><br>
				      	</div>
			      	</div>
			      </div>
				  <div>
			      	<div style="border: solid #e2e2e2 1px; height: 30px; line-height: 30px;">
				      	<div style="padding-left: 20px;">
				      		<span style="font-size: 14px; ">好友列表</span><br>
				      	</div>
			      	</div>
			      </div>
			      <div th:each="friend:${friendlist}" th:attr="onclick='accountSubmit(this,'+${friend.phone}+')'" th:if="${friendlist}!=null">
			      	<div style="border: solid #e2e2e2 1px; height: 60px; line-height: 60px;" th:attr="onclick='linkmanMessageSelect('+${friend.phone}+')'">
				      	<div class="layui-col-md12" style="height: 60px; margin-left: 20px; width: 50px;">
				      		<img th:src="@{${friend.img}}" style="width: 40px; height: 40px; border-radius: 50%;" alt="头像"><br><br>
				      	</div>
				      	<div style="padding-left: 50px;">
				      		<span style="font-size: 18px; ">[[${friend.phone}]]</span><br>
				      	</div>
			      	</div>
			      </div>
		      </div>
		    </div>
		</div>
	    </div>
	    <div class="col-sm-9" style="background-color: #fff; background-image: url('/img/linkman.png'); padding-right: 0px;">
		    <div class="layui-col-sm12" style="" id="chatMessage">
		    	<div style="margin: 15px 100px; overflow: auto; max-height: 240px;" id="containerDiv4">
				</div>
				<div class="layui-col-sm3" style="height: 100%">&nbsp;</div>
				<div class="layui-col-sm6" style="background-color: #F8F8FF;" id="linkmanOneMessage" >
				</div>
		    </div>
	    </div>
	</div>
</div>




<script src="/js/jquery.js"></script>
<script src="/js/socket/socket.io.js"></script>                  
<script type="text/javascript">
//添加群聊
function selectLinkmanAndGroupChat(){
	closeTheQueryInformation();
	parent.layui.admin.prompt({
		title : '请输入要添加的好友账号或群号',
		formType : 0
	}, function(value, index, elem) {
		parent.layer.close(index);
		let params = {};
		params.id = value;
		$.ajax({
			url : '/exchange/selectLinkmanAndGroupChat',
			type : 'post',
			data : params,
			dataType : 'json',
			success : function(data) {
				if (data.code == 0) {
					layer.msg(data.msg, {icon : 1 });
					if(data.userandgroup==1){
						let linkmanAndGroupChat = '<div style="border-bottom: solid #e2e2e2 1px; margin: 0 20px;">'
				      	+'<div class="layui-col-md12" style="height: 75px; margin-left: 10px; width: 120px; line-height: 75px;">'
				      	+	'<i class="layui-icon layui-icon-group" style="font-size: 80px; color: #5FB878;"></i>'
				      	+'</div>'
				      	+'<div style="padding-left: 80px; margin-bottom: 15px; margin-top: 15px;">';
				      	if(data.name==''){
				      		linkmanAndGroupChat += '<span style="font-size: 18px; "><b>'+data.phone+'</b></span><br>';
				      	} else {
				      		linkmanAndGroupChat += '<span style="font-size: 18px; "><b>'+data.name+'</b></span><br>';
				      	}
				      	if(data.jurisdiction==0){
				      		linkmanAndGroupChat += '<span style="font-size: 14px; ">学生</span><br>';
				      	} else {
				      		linkmanAndGroupChat += '<span style="font-size: 14px; ">教师</span><br>';
				      	}
				      	linkmanAndGroupChat += '<span style="font-size: 14px; ">'+data.perSignature+'</span><br>'
					    +  	'</div>'
				      	+'</div>'
						+'<div style="margin: 15px 40px;">'
						+	'账号：<span>'+data.phone+'</span><br>'
						+	'昵称：<span>'+data.name+'</span><br>'
						+	'年龄：<span>'+data.age+'岁</span><br>';
						if(data.sex==0){
							linkmanAndGroupChat += '性别：<span>未知</span><br>';
						} else if(data.sex == 1){
							linkmanAndGroupChat += '性别：<span>男</span><br>';
						} else {
							linkmanAndGroupChat += '性别：<span>女</span><br>';
						}
						linkmanAndGroupChat += '生日：<span>'+data.brithday+'</span><br>'
						+ '邮箱：<span>'+data.email+'</span><br>';
						if(data.jurisdiction==0){
							linkmanAndGroupChat += '身份：<span>学生</span><br>';
						} else {
							linkmanAndGroupChat += '身份：<span>教师</span><br>';
						}
						if(data.grade==0) {
							linkmanAndGroupChat += '年级：<span>暂未知</span><br>'
						} else if(data.grade==1) {
							linkmanAndGroupChat += '年级：<span>初三以下</span><br>';
						} else if(data.grade==2) {
							linkmanAndGroupChat += '年级：<span>初三</span><br>';
						} else if(data.grade==3) {
							linkmanAndGroupChat += '年级：<span>高一</span><br>';
						} else if(data.grade==4) {
							linkmanAndGroupChat += '年级：<span>高二</span><br>';
						} else if(data.grade==5) {
							linkmanAndGroupChat += '年级：<span>高三</span><br>';
						} else if(data.grade==6) {
							linkmanAndGroupChat += '年级：<span>初三以上</span><br>';
						}
						linkmanAndGroupChat += '学校：<span>'+data.school+'</span><br>'
						+'</div>'
						+'<div style="text-align: center; margin-bottom: 15px;">'
						+	'<span type="button" class="layui-btn layui-btn-primary" onclick="closeTheQueryInformation()">关&emsp;&emsp;闭</span>'
						+	'<span type="button" class="layui-btn layui-btn-normal" onclick="addNewLinkmanAndGroupChat('+data.id+','+data.userandgroup+')">添加好友</span>'
						+'</div>';
						$("#linkmanOneMessage").html(linkmanAndGroupChat);
					} else {
						let linkmanAndGroupChat = '<div style="border-bottom: solid #e2e2e2 1px; margin: 0 20px;">'
					      	+'<div class="layui-col-md12" style="height: 75px; margin-left: 10px; width: 120px; line-height: 75px;">'
					      	+	'<i class="layui-icon layui-icon-group" style="font-size: 80px; color: #5FB878;"></i>'
					      	+'</div>'
					      	+'<div style="padding-left: 80px; margin-bottom: 15px; margin-top: 15px;">'
					      	+'<span style="font-size: 18px; "><b>'+data.name+'</b></span><br>'
					      	+'<span style="font-size: 14px; ">'+data.guse+'</span><br>'
					      	+'<span style="font-size: 14px; ">'+data.jurisdiction+'</span><br>'
						    +  	'</div>'
					      	+'</div>'
							+'<div style="margin: 15px 40px; line-height:40px;">'
							+	'群&emsp;号：<span>'+data.phone+'</span><br>'
							+	'群&emsp;名：<span>'+data.name+'</span><br>'
							+	'时&emsp;间：<span>'+data.gdata+'</span><br>'
							+	'创建者：<span>'+data.guname+'</span><br>'
							+	'人&emsp;数：<span>'+data.gnumber+'</span><br>'
							+	'用&emsp;途：<span>'+data.guse+'</span><br>'
							+'</div>'
							+'<div style="text-align: center; margin-bottom: 15px;">'
							+	'<span type="button" class="layui-btn layui-btn-primary" onclick="closeTheQueryInformation()">关&emsp;&emsp;闭</span>'
							+	'<span type="button" class="layui-btn layui-btn-normal" onclick="addNewLinkmanAndGroupChat('+data.id+','+data.userandgroup+')">加入群聊</span>'
							+'</div>';
							$("#linkmanOneMessage").html(linkmanAndGroupChat);
					}
				} else {
					layer.msg(data.msg, {icon : 2 });
				}
			}
		});
	});
}
//查看好友或群聊的信息
function linkmanMessageSelect(value){
	closeTheQueryInformation();
	let height = window.innerHeight;
	let params = {};
	params.id = value;
	$.ajax({
		url : '/exchange/selectLinkmanAndGroupChat',
		type : 'post',
		data : params,
		dataType : 'json',
		success : function(data) {
			if (data.code == 0) {
				if(data.userandgroup==1){
					let linkmanAndGroupChat = '<div style="border-bottom: solid #e2e2e2 1px; margin: 0 20px;">'
			      	+'<div class="layui-col-md12" style="height: 75px; margin-left: 10px; width: 120px; line-height: 75px;">'
			      	+	'<i class="layui-icon layui-icon-group" style="font-size: 80px; color: #5FB878;"></i>'
			      	+'</div>'
			      	+'<div style="padding-left: 80px; margin-bottom: 15px; margin-top: 15px;">';
			      	if(data.name==''){
			      		linkmanAndGroupChat += '<span style="font-size: 18px; "><b>'+data.phone+'</b></span><br>';
			      	} else {
			      		linkmanAndGroupChat += '<span style="font-size: 18px; "><b>'+data.name+'</b></span><br>';
			      	}
			      	if(data.jurisdiction==0){
			      		linkmanAndGroupChat += '<span style="font-size: 14px; ">学生</span><br>';
			      	} else {
			      		linkmanAndGroupChat += '<span style="font-size: 14px; ">教师</span><br>';
			      	}
			      	linkmanAndGroupChat += '<span style="font-size: 14px; ">'+data.perSignature+'</span><br>'
				    +  	'</div>'
			      	+'</div>'
					+'<div style="margin: 15px 40px;">'
					+	'账号：<span>'+data.phone+'</span><br>'
					+	'昵称：<span>'+data.name+'</span><br>'
					+	'年龄：<span>'+data.age+'岁</span><br>';
					if(data.sex==0){
						linkmanAndGroupChat += '性别：<span>未知</span><br>';
					} else if(data.sex == 1){
						linkmanAndGroupChat += '性别：<span>男</span><br>';
					} else {
						linkmanAndGroupChat += '性别：<span>女</span><br>';
					}
					linkmanAndGroupChat += '生日：<span>'+data.brithday+'</span><br>'
					+ '邮箱：<span>'+data.email+'</span><br>';
					if(data.jurisdiction==0){
						linkmanAndGroupChat += '身份：<span>学生</span><br>';
					} else {
						linkmanAndGroupChat += '身份：<span>教师</span><br>';
					}
					if(data.grade==0) {
						linkmanAndGroupChat += '年级：<span>暂未知</span><br>'
					} else if(data.grade==1) {
						linkmanAndGroupChat += '年级：<span>初三以下</span><br>';
					} else if(data.grade==2) {
						linkmanAndGroupChat += '年级：<span>初三</span><br>';
					} else if(data.grade==3) {
						linkmanAndGroupChat += '年级：<span>高一</span><br>';
					} else if(data.grade==4) {
						linkmanAndGroupChat += '年级：<span>高二</span><br>';
					} else if(data.grade==5) {
						linkmanAndGroupChat += '年级：<span>高三</span><br>';
					} else if(data.grade==6) {
						linkmanAndGroupChat += '年级：<span>初三以上</span><br>';
					}
					linkmanAndGroupChat += '学校：<span>'+data.school+'</span><br>'
					+'</div>'
					+'<div style="text-align: center; margin-bottom: 15px;">'
					+	'<span type="button" class="layui-btn layui-btn-primary" onclick="closeTheQueryInformation()">关&emsp;&emsp;闭</span>'
					+	'<span type="button" class="layui-btn layui-btn-danger" onclick="closeTheQueryInformation()">删除好友</span>'
					+	'<span type="button" class="layui-btn layui-btn-normal" onclick="addNewLinkmanAndGroupChat('+data.id+','+data.userandgroup+')">发送消息</span>'
					+'</div>';
					$("#linkmanOneMessage").html(linkmanAndGroupChat);
				} else {
					let linkmanAndGroupChat = '<div style="border-bottom: solid #e2e2e2 1px; margin: 0 20px;">'
				      	+'<div class="layui-col-md12" style="height: 75px; margin-left: 10px; width: 120px; line-height: 75px;">'
				      	+	'<i class="layui-icon layui-icon-group" style="font-size: 80px; color: #5FB878;"></i>'
				      	+'</div>'
				      	+'<div style="padding-left: 80px; margin-bottom: 15px; margin-top: 15px;">'
				      	+'<span style="font-size: 18px; "><b>'+data.name+'</b></span><br>'
				      	+'<span style="font-size: 14px; ">'+data.guse+'</span><br>'
				      	+'<span style="font-size: 14px; ">'+data.jurisdiction+'</span><br>'
					    +  	'</div>'
				      	+'</div>'
						+'<div style="margin: 15px 40px; line-height:40px;">'
						+	'群&emsp;号：<span>'+data.phone+'</span><br>'
						+	'群&emsp;名：<span>'+data.name+'</span><br>'
						+	'时&emsp;间：<span>'+data.gdata+'</span><br>'
						+	'创建者：<span>'+data.guname+'</span><br>'
						+	'人&emsp;数：<span>'+data.gnumber+'</span><br>'
						+	'用&emsp;途：<span>'+data.guse+'</span><br>'
						+'</div>'
						+'<div style="text-align: center; margin-bottom: 15px;">'
						+	'<span type="button" class="layui-btn layui-btn-primary" onclick="closeTheQueryInformation()">关&emsp;&emsp;闭</span>'
						+	'<span type="button" class="layui-btn layui-btn-danger" onclick="closeTheQueryInformation()">退出群聊</span>'
						+	'<span type="button" class="layui-btn layui-btn-normal" onclick="addNewLinkmanAndGroupChat('+data.id+','+data.userandgroup+')">加入群聊</span>'
						+'</div>';
						$("#linkmanOneMessage").html(linkmanAndGroupChat);
				}
			} else {
				layer.msg(data.msg, {icon : 2 });
			}
		}
	});
}
//新的好友
function newLinkman(){
	closeTheQueryInformation();
	let params = {};
	$.ajax({
		url : '/exchange/newLinkman',
		type : 'post',
		data : params,
		dataType : 'json',
		success : function(data) {
			if (data=='') {
				layer.msg('暂无新的信息需要处理', {icon : 2 });
			} else {
				var data2 = eval(data);
				let dataMessage = '<table class="layui-table" style="padding-top: 0px;margin-top: 0px;" id="folderMessageTable">'
					  +'<tbody>'
				    +'<tr><th>昵称</th><th>备注</th><th width="170">操作</th></tr>';
				for(let i in data2){
					if(data2[i].ispass==1){
						dataMessage += '<tr>'
						    +	'<td>'+data2[i].uname+'</td>'
						    +	'<td>'+data2[i].message+'</td>'
						    +	'<td>'
							+     	'<span class="layui-btn layui-btn-danger layui-btn-xs" onclick="refusedToAdd('+data2[i].uid+',this);">删除</span>'
						    +	'</td>'
						    +'</tr>';
					} else {
						dataMessage += '<tr>'
						    +	'<td>'+data2[i].uname+'</td>'
						    +	'<td>'+data2[i].message+'</td>'
						    +	'<td>'
							+    	'<span class="layui-btn layui-btn-warm layui-btn-xs" onclick="adderInformationDetails('+data2[i].uid+','+data2[i].phone+',this);">详情</span>'
							+     	'<span class="layui-btn layui-btn-danger layui-btn-xs" onclick="refusedToAdd('+data2[i].uid+',this);">拒绝</span>'
							+     	'<span class="layui-btn layui-btn-normal layui-btn-xs" onclick="agreeToAdd('+data2[i].uid+',this);">同意</span>'
						    +	'</td>'
						    +'</tr>';
					}
				}
				dataMessage += '<tr><td colspan="3" style="text-align: center;"><span class="layui-btn layui-btn-primary layui-btn-xs" onclick="closeTheQueryInformation();">关闭页面</span></td></tr>'
				  	+'</tbody>'
					+'</table>';
				$("#containerDiv4").html(dataMessage);
			}
		}
	});
}
//查看添加者信息
function adderInformationDetails(uid,phone,thiss){
	let params = {};
	params.id = phone;
	$.ajax({
		url : '/exchange/selectLinkmanAndGroupChat',
		type : 'post',
		data : params,
		dataType : 'json',
		success : function(data) {
			if (data.code == 0) {
				if(data.userandgroup==1){
					let linkmanAndGroupChat = '<div style="border-bottom: solid #e2e2e2 1px; margin: 0 20px;">'
			      	+'<div class="layui-col-md12" style="height: 75px; margin-left: 10px; width: 120px; line-height: 75px;">'
			      	+	'<i class="layui-icon layui-icon-group" style="font-size: 80px; color: #5FB878;"></i>'
			      	+'</div>'
			      	+'<div style="padding-left: 80px; margin-bottom: 15px; margin-top: 15px;">';
			      	if(data.name==''){
			      		linkmanAndGroupChat += '<span style="font-size: 18px; "><b>'+data.phone+'</b></span><br>';
			      	} else {
			      		linkmanAndGroupChat += '<span style="font-size: 18px; "><b>'+data.name+'</b></span><br>';
			      	}
			      	if(data.jurisdiction==0){
			      		linkmanAndGroupChat += '<span style="font-size: 14px; ">学生</span><br>';
			      	} else {
			      		linkmanAndGroupChat += '<span style="font-size: 14px; ">教师</span><br>';
			      	}
			      	linkmanAndGroupChat += '<span style="font-size: 14px; ">'+data.perSignature+'</span><br>'
				    +  	'</div>'
			      	+'</div>'
					+'<div style="margin: 15px 40px;">'
					+	'账号：<span>'+data.phone+'</span><br>'
					+	'昵称：<span>'+data.name+'</span><br>'
					+	'年龄：<span>'+data.age+'岁</span><br>';
					if(data.sex==0){
						linkmanAndGroupChat += '性别：<span>未知</span><br>';
					} else if(data.sex == 1){
						linkmanAndGroupChat += '性别：<span>男</span><br>';
					} else {
						linkmanAndGroupChat += '性别：<span>女</span><br>';
					}
					linkmanAndGroupChat += '生日：<span>'+data.brithday+'</span><br>'
					+ '邮箱：<span>'+data.email+'</span><br>';
					if(data.jurisdiction==0){
						linkmanAndGroupChat += '身份：<span>学生</span><br>';
					} else {
						linkmanAndGroupChat += '身份：<span>教师</span><br>';
					}
					if(data.grade==0) {
						linkmanAndGroupChat += '年级：<span>暂未知</span><br>'
					} else if(data.grade==1) {
						linkmanAndGroupChat += '年级：<span>初三以下</span><br>';
					} else if(data.grade==2) {
						linkmanAndGroupChat += '年级：<span>初三</span><br>';
					} else if(data.grade==3) {
						linkmanAndGroupChat += '年级：<span>高一</span><br>';
					} else if(data.grade==4) {
						linkmanAndGroupChat += '年级：<span>高二</span><br>';
					} else if(data.grade==5) {
						linkmanAndGroupChat += '年级：<span>高三</span><br>';
					} else if(data.grade==6) {
						linkmanAndGroupChat += '年级：<span>初三以上</span><br>';
					}
					linkmanAndGroupChat += '学校：<span>'+data.school+'</span><br>'
					+'</div>'
					+'<div style="text-align: center; margin-bottom: 15px;">'
					+	'<span type="button" class="layui-btn layui-btn-danger" onclick="refusedToAdd('+uid+','+thiss+')">拒&emsp;&emsp;绝</span>'
					+	'<span type="button" class="layui-btn layui-btn-normal" onclick="agreeToAdd('+uid+','+thiss+')">同&emsp;&emsp;意</span>'
					+'</div>';
					$("#linkmanOneMessage").html(linkmanAndGroupChat);
					$("#linkmanOneMessage").css("margin-top",$("#containerDiv4").attr)
					let contHeight = document.getElementById("containerDiv4").offsetHeight;
					if(contHeight>215){
						$("#linkmanOneMessage").css("margin-top", "0px");
					} else {
						$("#linkmanOneMessage").css("margin-top",(215-contHeight)+'px');
					}
				} 
			} else {
				layer.msg(data.msg, {icon : 2 });
			}
		}
	});
}

//同意添加好友/或进群
function agreeToAdd(uid, thiss){
	parent.layui.admin.prompt({
		title : '请为该好友添加备注',
		formType : 0
	}, function(value, index, elem) {
		parent.layer.close(index);
		let params = {};
		params.id = uid;
		params.message = value;
		$.ajax({
			url : '/exchange/agreeToAdd',
			type : 'post',
			data : params,
			dataType : 'json',
			success : function(data) {
				if (data.code==0) {
					layer.msg(data.msg, {icon : 1 });
					let tr=thiss.parentNode.parentNode;
            		let tbody=tr.parentNode;
            		tbody.removeChild(tr);
				} else {
					layer.msg(data.msg, {icon : 2 });
				}
			}
		});
	});
}
//拒绝添加好友或进群
function refusedToAdd(uid,thiss){
	parent.layui.admin.prompt({
		title : '请输入拒绝的理由',
		formType : 2
	}, function(value, index, elem) {
		parent.layer.close(index);
		let params = {};
		params.id = uid;
		params.message = '【被拒绝】'+value;
		$.ajax({
			url : '/exchange/refusedToAdd',
			type : 'post',
			data : params,
			dataType : 'json',
			success : function(data) {
				if (data.code==0) {
					layer.msg(data.msg, {icon : 1 });
					let tr=thiss.parentNode.parentNode;
            		let tbody=tr.parentNode;
            		tbody.removeChild(tr);
				} else {
					layer.msg(data.msg, {icon : 2 });
				}
			}
		});
	});
}
//关闭查询信息
function closeTheQueryInformation(){
	$("#linkmanOneMessage").html('');
	$("#containerDiv4").html('');
	let height = window.innerHeight;
	if(height<800){
		height = 800;
	}
	$("#linkmanOneMessage").css("margin-top",(height-139-407)/2+"px");//基础214.5
}
//添加信息
function addNewLinkmanAndGroupChat(id,uag){
	parent.layui.admin.prompt({
		title : '填写验证信息',
		formType : 2
	}, function(value, index, elem) {
		parent.layer.close(index);
		let params = {};
		params.beuid = id;
		params.uag = uag;
		params.message = value;
		$.ajax({
			url : '/exchange/addNewLinkmanAndGroupChat',
			type : 'post',
			data : params,
			dataType : 'json',
			success : function(data) {
				if (data.code == 0) {
					layer.msg(data.msg, {icon : 1 });
					closeTheQueryInformation();
				} else {
					layer.msg(data.msg, {icon : 2 });
				}
			}
		});
	});
}

$(function(){
	let height = window.innerHeight;
	if(height<800){
		height = 800;
	}
	$("#containerDiv").css("height",height-91+"px");
	$("#containerDiv2").css("height",height-95+"px");
	$("#containerDiv3").css("height",height-139+"px");
	$("#linkmanImg").css("height",height-139+"px");
	//$("#containerDiv4").css("height",(height-139-407)/2+"px");
	$("#linkmanOneMessage").css("margin-top",(height-139-407)/2+"px");//基础214.5
});
</script>
<a href="/message?name=" id="messageSub"></a>
</body>
<script>
var layedit;
var editIndex;
layui.use(['layer', 'form', 'xmSelect', 'layedit'], function () {
    var $ = layui.jquery;
    var layer = layui.layer;
    var form = layui.form;
    var xmSelect = layui.xmSelect;
    layedit = layui.layedit;
    editIndex = layedit.build('eQuestionContentEdt', {tool: ['face'],height: 106});
});
var sname = '';
function accountSubmit(thiss,id){
	sname = id;
	$(thiss).css("background-color","#D3D3D3");
	$("#currentObject").html(id);
}
const socket = io.connect('http://127.0.0.1:8888?userphone='+$("#userphone").attr("name"));
socket.on('connect', () => {
	layer.msg('已成功连接到服务器',{icon: 1});
})
socket.on('server_event', data => {
	if($("#currentObject").html().trim()!=''){
		if(data.isme==1){
			$("#chatMessage").append('<span style="color: #3CB371">'+data.author+'  '+data.date+'</span><br>');
		} else {
			$("#chatMessage").append('<span style="color: #0000FF">'+data.author+'  '+data.date+'</span><br>');
		}
		$("#chatMessage").append('&emsp;'+data.msg+'<br>');
	}
	$("#endMessage").html(data.msg);
});
socket.on('disconnect', () => {
	layer.msg('该账户已下线',{icon: 2});
})
function sendMessageNoParameter(){
	if(sname===''){
		return null;
	}
	var sendContent = layedit.getContent(editIndex)+'';
	let params = {};
    params.msg = sendContent;
    params.fname = $("#userphone").attr("name")+'';
    params.sname = sname;
    editIndex = layedit.build('eQuestionContentEdt', {tool: ['face'],height: 106});
    $.ajax( {
	        url : '/chatroom/send', 
	        type : 'post',
	        data: params,
	        dataType : 'json',
	});
}
layui.use('element', function(){
	  var element = layui.element;
	});
</script>
</html>